<template>
  <div class="">
    <div class="banxin content">
      <div class="cons">
        <span class="leftg"></span>
        <input type="checkbox" class="chx" v-model="iData.ischx" />
        <input
          type="text"
          v-model="iData.txt"
          v-show="isShow"
          @keyup.enter="checkShow(iData.id)"
          :ref="'iData' + iData.id"
          class="iput"
        />
        <span v-show="!isShow">{{ iData.txt }}</span>
        <!-- 编辑.. -->
      </div>
      <div>
        <slot name="edit"></slot>
        <slot name="dele"></slot>
      </div>
    </div>
  </div>
</template>
 
<script>
import "../css/index.css";
export default {
  data() {
    return {
      isShow: false,
    };
  },
  props: ["iData"],
  methods: {
    checkShow(id) {
      this.isShow = !this.isShow;
      if (this.$refs["iData" + id]) {
        this.$nextTick(() => {
          this.$refs["iData" + id].focus();
        });
      }
    },
  },
};
</script>
 
<style lang = "less" scoped>
</style>